package com.dodoke.domain.vo;

import com.dodoke.common.utils.Arith;
import com.dodoke.domain.WxAddresss;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

public class WxOrderVo implements Serializable {

    /** 主键id */
    private Long id;

    /** 订单编号 */
    private String number;

    /** 用户id */
    private Long userId;

    /** 地址id */
    private Long addressId;

    /** 商品名称 */
    private String goodsName;

    /** 商品成本 */
    private Double goodsCostPrice;

    /** 商品中奖价 */
    private Double goodsWinningPrice;

    /** 利润 */
    private Double profit;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /** 结束时间，用于后台管理人员按时间范围搜索使用 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;

    /** 订单所关联的用户信息 */
    private WxUserVo wxUserVo;

    /** 订单所关联的地址信息 */
    private WxAddresss wxAddress;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getAddressId() {
        return addressId;
    }

    public void setAddressId(Long addressId) {
        this.addressId = addressId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public Double getGoodsCostPrice() {
        return goodsCostPrice;
    }

    public void setGoodsCostPrice(Double goodsCostPrice) {
        this.goodsCostPrice = goodsCostPrice;
    }

    public Double getGoodsWinningPrice() {
        return goodsWinningPrice;
    }

    public void setGoodsWinningPrice(Double goodsWinningPrice) {
        this.goodsWinningPrice = goodsWinningPrice;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public WxUserVo getWxUserVo() {
        return wxUserVo;
    }

    public void setWxUserVo(WxUserVo wxUserVo) {
        this.wxUserVo = wxUserVo;
    }

    public WxAddresss getWxAddress() {
        return wxAddress;
    }

    public void setWxAddress(WxAddresss wxAddress) {
        this.wxAddress = wxAddress;
    }

    public Double getProfit() {
        return Arith.sub(getGoodsWinningPrice(),getGoodsCostPrice());
    }

    public void setProfit(Double profit) {
        this.profit = profit;
    }
}
